<template>
  <div>
    <h2>{{msg}}</h2>
    <h3>{{name}}</h3>
    <h3>{{myAddress}} {{myAge}}</h3>
    <button @click="changeAddr">详细地址</button>
    <button @click="changeAge">年龄+1</button>
  </div>
</template>

<script>
export default {
  name: 'School',
  data() {
    return {
      msg: '我是一所大学',
      myAddress: this.address,
      myAge: this.age
    }
  },
  methods: {
    changeAge() {
      this.myAge++
    },
    changeAddr() {
      this.myAddress = '辽宁省大连市'
    }
  },
  // 动态更改的数据，写在这里
  // props: ['name', 'address']
  // 限制数据类型
  props: {
    name: String,
    address: String,
    age: Number
  }
}
</script>

<style>
</style>